package com.example.springboot.service;

import com.example.springboot.entity.Goods;
import com.example.springboot.mapper.GoodsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    public int save(Goods goods){
        if(goods.getId()==null){
            return goodsMapper.insert(goods);
        }else{
            return goodsMapper.update(goods);
        }
    }
}
